//201902104003邵潇漩
package bysj.domain;

import bysj.domain.authority.Actor;
import bysj.domain.authority.Role;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Collection;

public class User  implements Comparable<User>, Serializable {
	private Integer id;
	private String username;
	private String password;
	private LocalDateTime loginTime;
	private Actor actor;
	private Collection<Role> roles;

	public User(){}

	public User(String username, String password, LocalDateTime loginTime,
				Actor actor) {
		super();
		this.username = username;
		this.password = password;
		this.loginTime = loginTime;
		this.actor = actor;
	}

	public User(Integer id, String username, String password, LocalDateTime loginTime,
				Actor actor) {
		this(username, password, loginTime, actor);
		this.id = id;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public LocalDateTime getLoginTime() {
		return loginTime;
	}

	public void setLoginTime(LocalDateTime loginTime) {
		this.loginTime = loginTime;
	}

	public Actor getActor() {
		return actor;
	}

	public void setActor(Actor actor) {
		this.actor = actor;
	}

	public Collection<Role> getRoles() {
		return roles;
	}

	public void setRoles(Collection<Role> roles) {
		this.roles = roles;
	}

	/**
	 * Constructs a <code>String</code> with all attributes
	 * in name = value format.
	 *
	 * @return a <code>String</code> representation
	 * of this object.
	 */
	public String toString()
	{
		final String TAB = "    ";

		String retValue = "";

		retValue = "Login ( "
				+ super.toString() + TAB
				+ "id = " + this.id + TAB
				+ "username = " + this.username + TAB
				+ "password = " + this.password + TAB
				+ "loginTime = " + this.loginTime + TAB
				+ "teacher = " + this.actor + TAB
				+ " )";

		return retValue;
	}

	@Override
	public int compareTo(User o) {
		// TODO Auto-generated method stub
		return this.id-o.id;
	}

}